﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace TOOLS
{
    public static class DictionaryCreator
    {
        public static void CreateDictionary()
        {
            string line;
            string elements = "";
            string xml = "";
            
            // Read the file and create xml
            System.IO.StreamReader inputFile = new System.IO.StreamReader(@"..\..\Data\team_conf_div_list.txt");
            System.IO.StreamWriter outputFile = new System.IO.StreamWriter(@"..\..\Data\NFL_DICT.xml");

            while((line = inputFile.ReadLine()) != null)
            {
                elements = elements + string.Format(@"  <elem>
                                                            <id>{0}</id>    
                                                            <description>{1}</description>
                                                            <conference>{2}</conference>
                                                            <division>{3}</division>
                                                            <off_line_schema></off_line_schema>
                                                            <qb_schema></qb_schema>
                                                            <def_schema></def_schema>
                                                        </elem>", 
                                                line.Split(' ')[0], 
                                                line.Split(' ')[1], 
                                                line.Split(' ')[2], 
                                                line.Split(' ')[3]);
                
            }

            xml = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\" ?><NFL>{0}</NFL>",elements);
            outputFile.Write(xml);

            inputFile.Close();
            outputFile.Close();
        }

    }
}
